<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

	<head>
		<meta charset="utf-8">
		<title>
			行程评论
		</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="format-detection" content="telephone=no">
		<link rel="stylesheet" href="/houtaistatic/css/x-admin.css" media="all">
		<style type="text/css">
			/*设置 a 标签的css样式*/
			
			.page-normal a {
				border: 1px solid #ff6500;
				padding: 5px 7px;
				color: #ff6500;
				margin-left: 20px;
				/*设置标签 a 之间的间隔*/
				text-decoration: none;
				/*去除页码数字下面的下划线*/
			}
			/*设置鼠标经过时 a 标签的css样式*/
			
			.page-normal a:hover {
				background-color: #ffbe94;
			}
			/*设置整个div的css样式,该样式主要用于设置网页内的省略号 …… 的样式，并且同时设置内容居中显示*/
			
			.page-normal {
				color: #ff6500;
				text-align: center;
			}
			/*设置当前页面的css样式*/
			
			.page-normal .page-current {
				color: #ffffff;
				background-color: #ff6500;
			}
			/*设置左单括号 < 的css样式*/
			
			.page-normal .page-prev {
				color: #ffe3c6;
			}
			/*进行代码优化，将不同css样式中共有的属性放在一起，有助于提高运行效率*/
			
			.page-normal a,
			.page-normal a:hover,
			.page-normal .page-prev,
			.page-normal .page-current {
				border: 1px solid #ff6500;
				padding: 5px 7px;
			}
		</style>
	</head>

	<br>
		<div class="x-nav">
			<span class="layui-breadcrumb">
              <a><cite>首页</cite></a>
              <a><cite>评论管理</cite></a>
              <a><cite>用户评论</cite></a>
            </span>
			<a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新"><i class="layui-icon" style="line-height:30px">ဂ</i></a>
		</div>
		<br class="x-body">
			<form class="layui-form x-center" action="" style="width:800px">
				<div class="layui-form-pane" style="margin-top: 15px;">
					<div class="layui-form-item">

						<label class="layui-form-label">行程查询</label>
						<div class="layui-input-inline">
							<select style="display: inline-block;width: 190px; height: 38px;" name = "rid" id="xunzhong">
								<option>请选择</option>
								<option th:each="hun:${rlist}" th:text="${hun.title}" th:value="${hun.id}"></option>
							</select>
						</div>
					
						<div class="layui-input-inline" style="width:80px">
							<button class="layui-btn" lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
						</div>
					</div>
				</div>
			</form>
			<table class="layui-table">
				<thead>
					<tr>
						<th>
							<input type="checkbox" name="" value="">
						</th>
						<th>
							编号
						</th>
						<th>
							用户名
						</th>
						<th>
							行程名称
						</th>
						<th>
							评论内容
						</th>
						<th>
							评论时间
						</th>
						<th>
							商家回复
						</th>
						<th>
							回复
						</th>
						
						<th>
							评分等级
						</th>
					</tr>
				</thead>
				<tbody>
					<tr th:each="comm : ${commList}">
						<td>
							<input type="checkbox" value="1" name="">
						</td>
						<td th:text="${comm.id}">
							1
						</td>
						<td th:text="${comm.userName}">

                               	肖玉鹏

						</td>
						<td th:text="${comm.rName}">
							【私家小团，4-6人游】法瑞意历史经典与自然美景12日9晚品质游
						</td>
						<td th:text="${comm.content}">
							13000000000
						</td>
						<td th:text="${#dates.format(comm.createTime,'yyyy-MM-dd HH:ss')}">
							admin@mail.com
						</td>
						<td th:text="${comm.reply}" th:data-hui="${comm.reply}">
							北京市 海淀区 撒撒旦发射点发射点发射点发射点发射点发射点发射点发生打发手动阀手动阀手动阀阿凡达手动阀手动阀
						</td>
						
						<td class="td-status">
							<button class="layui-btn"  lay-filter="sreach" th:data-id="${comm.id}"><i class="layui-icon">回复</i></button>
						</td>
						<td class="td-manage" th:text="${comm.gradeLevenName}">
							好评
						</td>
					</tr>
				</tbody>
			</table>
			<div class="page-normal">
				<a class="page-prev"  th:if="${page.getCurrentPageNo() gt 1}" th:href="'/comment/goshanglist?index=' + ${page.getCurrentPageNo() - 1}+'&rid='+${rid}">&lt;</a>
				<!-- 数字1 代表当前页面-->
				<a class="page-current"th:href="'/comment/goshanglist?index=1'+'&rid='+${rid}">首页</a>
				<a th:href="'/comment/goshanglist?index=2'+'&rid='+${rid}" >2</a>
				<a th:href="'/comment/goshanglist?index=3'+'&rid='+${rid}">3</a>
				<a th:href="'/comment/goshanglist?index=4'+'&rid='+${rid}">4</a>
				<a href="" th:href="'/comment/goshanglist?index=' + ${page.getTotalPageCount()}+'&rid='+${rid}">最后一页</a>
				<a th:if="${page.getCurrentPageNo() lt page.getTotalPageCount()}" th:href="'/comment/goshanglist?index='+ ${page.getCurrentPageNo() + 1}+'&rid='+${rid}" >&gt;</a>
			</div>
			<span th:text="'当前页也为'+${page.getCurrentPageNo()}" style="font-weight: bold;color: red"></span></br>
	<span th:text="'一共'+${page.getTotalPageCount()}+'页'" style="font-weight: bold;color: red"></span></br>
		<span th:text="'一共'+${page.getTotalCount()}+'条记录'" style="font-weight: bold;color: red"></span>

		</div>
			<script src="/houtaistatic/js/jquery.min.js" type="text/javascript"></script>
			<script type="text/javascript">

				$(function(){
					//alert("草泥马马勒戈壁");
					var rid = [[${rid}]];
					$("#xunzhong option").each(function () {
						var val = $(this).val();
						if(val==rid){
							$(this).attr("selected",true);
						//	alert(rid+""+val);
							return;
						}
					});


				   var num = [[${page.getCurrentPageNo()}]];
				   parseInt(num);

					if(num > 4){
						var hun =$(".page-normal a").eq(num);
						hun.css("background-color","#ff6500");
						hun.css("color","white");
						hun.siblings().css("background-color","white");
						hun.siblings().css("color","black");
					}else{
						var hun =$(".page-normal a").eq(6);
						hun.css("background-color","#ff6500");
						hun.css("color","white");
						hun.siblings().css("background-color","white");
						hun.siblings().css("color","black");
					}
					$(".page-normal a").click(function(){
						$(this).css("background-color","#ff6500");
						$(this).css("color","white");
						$(this).siblings().css("background-color","white");
						$(this).siblings().css("color","black");
						
					});
					$(".td-status button").click(function(){
						var id =	$(this).attr("data-id");
						var hun = $(this).parent().prev().attr("data-hui");
						var fu = $(this).parent().prev();
						if(hun != null && hun!=""){
							alert("你已回复过 ");
						}else{
							var name=prompt("请输入回复内容","谢谢，希望可以再次合作");
							if(name !=null && name!=""){
								$.ajax({
									url:"/comment/reply?id="+id+"&reply="+name,
									type:"get",
									dataType:"text",
									error:function(){
										alert("操作失败");
									},
									success:function(data){
										if(data =="0"){
											alert("操作失败")
										}else{
											alert("回复成功");
											fu.text(name);
											fu.attr("data-hui",name);
										}
									}
								});
							}
						}

					});

				});
				
			</script>

	</body>
</html>